//
// Created by alexa on 5/13/2024.
//

#ifndef ARTILLERYSYSTEM_SOLDIERREPOSITORY_H
#define ARTILLERYSYSTEM_SOLDIERREPOSITORY_H


#include "../../entities/soldier/Soldier.h"
#include "../../entities/_identifiable/IdentifiableList.h"

class SoldierRepository {
private:
    IdentifiableList<Soldier> source;

    string fileSourcePath;
public:
    virtual ~SoldierRepository();

    explicit SoldierRepository(const string &fileSourcePath = "soldiers.json");

    const string &getFileSourcePath() const;

    void setFileSourcePath(const string &fileSourcePath);

    void loadDataFromFile();

    void saveDataToFile();

    Soldier *findById(string id);

    void save(Soldier *soldier);

    void deleteOne(Soldier *soldier);

    vector<Soldier *> findAll();
};


#endif //ARTILLERYSYSTEM_SOLDIERREPOSITORY_H
